package com.example.translator;

import java.io.File;

public class FileInfo {
    private final File file;
    private final String originalName;
    private final String extension;
    private String translatedName;
    private boolean translationStatus;
    private String errorMsg;

    public FileInfo(File file) {
        this.file = file;
        String fileName = file.getName();
        
        // 分离文件名和扩展名
        int dotIndex = fileName.lastIndexOf('.');
        if (dotIndex > 0 && dotIndex < fileName.length() - 1) {
            this.originalName = fileName.substring(0, dotIndex);
            this.extension = fileName.substring(dotIndex);
        } else {
            this.originalName = fileName;
            this.extension = "";
        }
        
        this.translatedName = "";
        this.translationStatus = false;
        this.errorMsg = "";
    }

    public File getFile() {
        return file;
    }

    public String getOriginalName() {
        return originalName;
    }

    public String getExtension() {
        return extension;
    }

    public String getTranslatedName() {
        return translatedName;
    }

    public void setTranslatedName(String translatedName) {
        this.translatedName = translatedName;
    }

    public boolean isTranslationStatus() {
        return translationStatus;
    }

    public void setTranslationStatus(boolean translationStatus) {
        this.translationStatus = translationStatus;
    }

    public String getErrorMsg() {
        return errorMsg;
    }

    public void setErrorMsg(String errorMsg) {
        this.errorMsg = errorMsg;
    }

    public String getFullOriginalName() {
        return originalName + extension;
    }
}
